import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;

/**
 * @Author: hzj
 * @Date: create in 2021/7/12 16:44
 * @Description:
 */
public class Demo1 {
    public static void main(String[] args) throws Exception {
        // 创建客户端对象
        RestHighLevelClient client = new RestHighLevelClient(
                RestClient.builder(new HttpHost("localhost", 9200, "http"))
        );
        System.out.println("连接成功");
// 关闭客户端连接
        client.close();
        System.out.println("关闭");
    }
}
